﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using InteControlSys.ViewModel;

namespace InteControlSys.Template
{
    public class SampleTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            DataTemplate template = null;
            FrameworkElement element = container as FrameworkElement;
            if (item is AnalysGroupBriefViewModel)
            {
                template = element.FindResource("AnalysGroupBrief") as DataTemplate;
            }
            else if (item is BucketTransViewModel)
            {
                template = element.FindResource("BucketTrans") as DataTemplate;
            }
            else if (item is SampleAlarmViewModel)
            {
                template = element.FindResource("SampleAlarm") as DataTemplate;
            }
            else if (item is SampleRecordsViewModel)
            {
                template = element.FindResource("SampleRecords") as DataTemplate;
            }
            else if (item is SampleMadeViewModel)
            {
                template = element.FindResource("SampleMade") as DataTemplate;
            }
            else if (item is SampleSaveViewModel)
            {
                template = element.FindResource("SampleSave") as DataTemplate;
            }
            else if (item is DeliverBoxViewModel)
            {
                template = element.FindResource("DeliverBox") as DataTemplate;
            }
             return template;
        }
    }
}
